Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adapt imports replacement with tsconfig outDir depth #2707

Closed
wants to merge 1 commit into from

Conversation

mgrisole
Copy link

@mgrisole mgrisole commented Nov 14, 2023

Closes #2706

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?


Issue Number: 2706

What is the new behavior?

This PR introduces a function adaptPathWithConfig which translate the outDir attribute from the user tsconfig.json config into a relative path prepending the previously resolved one from replaceImportPath.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@mgrisole mgrisole force-pushed the relative-paths-resolution branch from 667e81b to 18f4364 Compare November 14, 2023 21:52
@mgrisole mgrisole force-pushed the relative-paths-resolution branch from 18f4364 to c5b171a Compare November 14, 2023 21:57
@@ -331,6 +334,24 @@ function isOptionalBoolean(text: string) {
return typeof text === 'string' && text === 'boolean | undefined';
}

function adaptPathWithConfig(inputPath: string) {
try {
const rawConfig = readFileSync('tsconfig.json', 'utf8');
Copy link
Member

@micalevisk micalevisk Nov 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm concerned with this hard code "tsconfig.json"

As a dev, we can name our tsconfig file as we wish, so this readFile will always fail.

Not sure how to handle this properly

@aqeelat
Copy link

aqeelat commented Jul 22, 2024

@kamilmysliwiec why was this PR closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adapt relative paths resolution to tsconfig outDir depth
5 participants